// mycomponent/microIndex_footer.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    activeId: {
      type: null,
    },
    self: {
      type: null,
    },
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {
      this.getiPnoneBottom();
    },
    moved() {},
    detached() {},
  },

  /**
   * 组件的初始数据
   */
  data: {
    iPnoneBottomBol: false,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    goTo(e) {
      let id = e.currentTarget.dataset.id;
      switch (id) {
      case "1":
        if (id != this.data.activeId) {
          wx.redirectTo({
            url: "/packageC/micro_communities/microIndex/microIndex",
          });
        }
        break;
      case "2":
        if (id != this.data.activeId) {
          wx.redirectTo({
            url: "/packageC/micro_communities/microAttention/microAttention",
          });
        }
        break;
      case "3":
        wx.navigateTo({
          url: "/packageC/micro_communities/microRelease/microRelease",
        });
        break;
      case "4":
        wx.navigateTo({
          url: "/packageC/micro_communities/microhomepage/microhomepage",
        });
        // if (id == this.data.activeId && !this.data.self) {
        //   //doNothing
        // } else {
        //   wx.redirectTo({
        //     url: "/packageC/micro_communities/microhomepage/microhomepage",
        //   });
        // }
        break;
      case "5":
        wx.reLaunch({
          url: "/packageG/member_v2/member_v2",
        });
        break;
      default:
        console.log("error");
      }
    },
    getiPnoneBottom() {
      let that = this;
      try {
        var value = wx.getStorageSync("iPhoneBottom");
        if (value) {
          that.setData({
            iPnoneBottomBol: true,
          });
          // Do something with return value
        }
      } catch (e) {
        // Do something when catch error
      }
    },
  },
});
